package leetcode_501_600;

public class LeeCode_520 {
    public static void main(String[] args) {
        System.out.println(detectCapitalUse("FlaG"));
    }
    private static boolean detectCapitalUse(String word) {
        int big = 0, sma = 0, n = word.length();
        for (int i = 0; i < n; i++) {
            char c = word.charAt(i);
            if (c >= 'a'){
                sma++;
            }else {
                big++;
            }
        }
        return sma == n || big == n || (big == 1 && word.charAt(0) >= 'A' && word.charAt(0) <= 'Z');
    }
}
